var http = require('http')
var fs = require('fs')
var server = http.createServer()
server.on('request', function (request, response) {
    // response.setHeader("Access-Control-Allow-Origin","*");  //设置response中header的配置，一个一个设置

    response.writeHead(200, {
        "Access-Control-Allow-Origin":"*",
        'Content-Type':'text/plain;charset=utf-8'
    });     //设置response中header的配置，同时设置多个
    fs.readFile('product.json', function(err, data) {
        response.end(data);
    });
});
server.listen(3000, function(err){
    console.log('listening port 3000....')
})